home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 274 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  27 lines

  1. Newsgroups: comp.lang.c++
  2. Path: cix.compulink.co.uk!usenet
  3. From: henri@cix.compulink.co.uk ("Henry Andrew")
  4. Subject: Re: Stack vs. Heap
  5. Message-ID: <DKLzyp.M19@cix.compulink.co.uk>
  6. Organization: IBM
  7. References: <30E556FB.20@zeta.org.au>
  8. Date: Wed, 3 Jan 1996 14:23:13 GMT
  9. X-News-Software: Ameol
  10.  
  11. It seems to me that even if your objects are large (that is they contain 
  12. a 'lot of'/'large' data members) the members can still come 'from the 
  13. stack' because when you come to create your 'top level' object just do 
  14. one 'new' and it all comes from the heap in one contiguous lump.
  15. 'new' and 'delete' are very important for dynamic structures the size (or 
  16. extent) of which is not known at compile time like directory trees and 
  17. other non-linear structures.
  18.  
  19. Throwing exceptions can cause problems if function local variables are 
  20. 'new'd as the 'delete' might get missed so leaving stuff in the heap.  
  21. For Windows programs this is not a problem because if it runs out of heap 
  22. we blame MS :-)  For our servers which run non-stop we cannot leak into 
  23. heap so we take a different view of 'new' and 'delete' and only use them 
  24. when we have to.
  25.  
  26. Yours &c. Henry
  27.